package cn.getech.data.development.controller;

import cn.getech.data.development.model.vo.TableStatisticsVO;
import cn.getech.data.development.service.*;
import cn.getech.data.intelligence.common.utils.R;
import cn.getech.system.center.annotation.SysLog;
import cn.getech.system.center.constant.OperationModulesEnum;
import cn.getech.system.center.constant.OperationTypeEnum;
import cn.getech.system.center.constant.module.ModuleEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 数据表统计信息
 */
@Slf4j
@Api(tags = "数据表统计信息")
@RestController
@RequestMapping("/bdp/tableStatic")
public class TableStatisticsController {

    @Autowired
    private TableStatisticsService tableStatisticsService;

    @ApiOperation("根据表id获取表的统计信息")
    @ApiResponses({@ApiResponse(code = 200, message = "Success", response = TableStatisticsVO.class)})
    @GetMapping("/saveOfYesterday/{tableId}")
    @SysLog(value="根据表id获取表的统计信息",type= OperationTypeEnum.SELECTCODE, modulesType = OperationModulesEnum.SYSMODECODE,platformModuleType = ModuleEnum.DATA_MAP_MODULE_CODE)
    public R saveOfYesterday(@PathVariable("tableId") Integer tableId) {
        return R.okWithData(tableStatisticsService.saveOfYesterday(tableId));
    }

}
